package com.easy.demo.service.impl;

import com.easy.demo.entity.User;
import com.easy.demo.mapper.UserMapper;
import com.easy.demo.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务逻辑接口实现类
 *
 * @author LZH
 * @version 1.0.6
 * @since 2023/06/06
 */
@Service
@AllArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserMapper mapper;

    /**
     * 查询所有数据
     *
     * @return {@link List}
     */
    @Override
    public List<User> getList() {
        return mapper.list();
    }

    /**
     * 修改数据
     *
     * @param user {@link User}
     * @return 是否成功
     */
    @Override
    public boolean update(User user) {
        return mapper.updateById(user) >= 1;
    }
}
